import pyautogui
import time
from threading import Timer

message = 'git branch'
time.sleep(2)
target_time = '2021-12-27 20:36:00'


def execute():
    current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    print("当前时间：", current_time, "，", "目标时间：", target_time)
    global t
    if current_time == target_time:
        pyautogui.typewrite(f'{message}\n')
    else:
        t = Timer(1, execute)
        t.start()


t = Timer(1, execute)
t.start()
